package com.imti.mall.sale.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.imti.mall.model.sms.pojo.SmsHomeAdvertise;
import com.imti.mall.sale.dao.SmsHomeAdvertiseDao;
import com.imti.mall.sale.service.SmsHomeAdvertiseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsHomeAdvertiseServiceImpl extends ServiceImpl<SmsHomeAdvertiseDao, SmsHomeAdvertise> implements SmsHomeAdvertiseService {
    @Autowired
    SmsHomeAdvertiseDao smsHomeAdvertiseDao;
    /**
     * 查询首页轮播广告表
     */
    @Override
    public List<SmsHomeAdvertise> findSmsHomeAdvertise(SmsHomeAdvertise smsHomeAdvertise,Integer pageSize, Integer pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        return smsHomeAdvertiseDao.findSmsHomeAdvertise(smsHomeAdvertise);
    }
    /**
     * 根据id查询首页轮播广告表
     */
    @Override
    public SmsHomeAdvertise getmsHomeAdvertise(Integer id) {
        return smsHomeAdvertiseDao.selectById(id);
    }

    /**
     * 修改首页轮播广告表
     * @param smsHomeAdvertise
     * @return
     */
    @Override
    public Integer updateSmsHomeAdvertise(SmsHomeAdvertise smsHomeAdvertise) {
        return smsHomeAdvertiseDao.updateSmsHomeAdvertise(smsHomeAdvertise);
    }
    /**
     * 删除首页轮播广告表
     * @param id
     * @return
     */
    @Override
    public Integer delSmsHomeAdvertise(Integer id) {
        return smsHomeAdvertiseDao.deleteById(id);
    }
    /**
     * 添加首页轮播广告表
     * @param smsHomeAdvertise
     * @return
     */
    @Override
    public Integer addSmsHomeAdvertise(SmsHomeAdvertise smsHomeAdvertise) {
        return smsHomeAdvertiseDao.insert(smsHomeAdvertise);
    }

    @Override
    public SmsHomeAdvertise getSmsHomeAdvertise(Long id) {
        return getById(id);
    }
}
